<%@page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<script type="text/javascript" src="static/js/cryptoJS/core-min.js"></script>
<script type="text/javascript" src="static/js/cryptoJS/aes.js"></script>
<script type="text/javascript" src="static/js/cryptoJS/mode-ecb.js"></script>
<script type="text/javascript">
	function hehe() {
		alert(Encrypt("我爱你"));
		alert(Decrypt(Encrypt("我爱你")));
	}
	function Encrypt(word) {
		var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
		var srcs = CryptoJS.enc.Utf8.parse(word);
		var encrypted = CryptoJS.AES.encrypt(srcs, key, {
			mode : CryptoJS.mode.ECB,
			padding : CryptoJS.pad.Pkcs7
		});
		return encrypted.toString();
	}
	function Decrypt(word) {
		var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
		var decrypt = CryptoJS.AES.decrypt(word, key, {
			mode : CryptoJS.mode.ECB,
			padding : CryptoJS.pad.Pkcs7
		});
		return CryptoJS.enc.Utf8.stringify(decrypt).toString();
	}
</script>
<html>
<body>
	<input type="button" onclick="hehe()">
</body>
</html>